// Test.cpp
// Licensed under GPLv2
// Terms available at http://www.gnu.org/licenses/gpl-2.0.txt

#include <vector>
#include <complex>
#include "Complex_Polynomial.h"
#include "Newton_Fractal.h"
#include "CImg.h"

//Eventually there will be an implementation of an interface.

int main() {

  //Initialising the random number generator:
  srand( time(NULL));
  Complex_Polynomial test;
  //I should assemble a better way of inputting the polynomial, but
  //that would require monkeying with stdin. Roots do not NEED to come
  //in pairs, the code will run no matter what. Simply push how many
  //roots you want into the vector, and run the code. The window can
  //also have its size and scale changed; clearly, a larger window
  //takes longer to map.
  test.roots.push_back(complex<double> ( -1 , 0 ));
  test.roots.push_back(complex<double> ( 1 , 0 ) ) ;
  test.roots.push_back(complex<double> ( 0 , 1 ) );
  test.roots.push_back(complex<double> ( 0 , - 1 ) );
  CImg<unsigned char> fractal =  plot(test, 400 , 400 , -2.0 , 2.0 ,
                                      -2.0 , 2.0, 1e-3);
  CImgDisplay main_disp(fractal.HSVtoRGB(),"Fractal");
  while ( !main_disp.is_closed() ){
    main_disp.wait();
    if (main_disp.button() ) break;
  }
  return 0;

}
